package com.air.ota.mo;

import com.air.common.exception.WrongFormatException;

public class EpayBalanceInfo {
	
	private Integer id;
	private String  rawInfo;
	private String  fileName;
	private String  sequenceId;
	private String  account;
	private Integer amount;
	private String chargeDate;
	private String chargeStatusCode;
	private String serviceCode;
	private String chargeSrc;
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getRawInfo() {
		return rawInfo;
	}
	public void setRawInfo(String rawInfo) {
		this.rawInfo = rawInfo;
	}
	public String getFileName() {
		return fileName;
	}
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}
	public String getSequenceId() {
		return sequenceId;
	}
	public void setSequenceId(String sequenceId) {
		this.sequenceId = sequenceId;
	}
	public String getAccount() {
		return account;
	}
	public void setAccount(String account) {
		this.account = account;
	}
	public Integer getAmount() {
		return amount;
	}
	public void setAmount(Integer amount) {
		this.amount = amount;
	}
	public String getChargeDate() {
		return chargeDate;
	}
	public void setChargeDate(String chargeDate) {
		this.chargeDate = chargeDate;
	}
	public String getChargeStatusCode() {
		return chargeStatusCode.toUpperCase();
	}
	public void setChargeStatusCode(String chargeStatusCode) {
		this.chargeStatusCode = chargeStatusCode.toUpperCase();
	}
	public String getServiceCode() {
		return serviceCode;
	}
	public void setServiceCode(String serviceCode) {
		this.serviceCode = serviceCode;
	}
	public String getChargeSrc() {
		return chargeSrc;
	}
	public void setChargeSrc(String chargeSrc) {
		this.chargeSrc = chargeSrc;
	}
	
	public void parse(String rawInfo,String fileName) throws WrongFormatException{
		
		String[] datas=rawInfo.split("|");
		if (datas.length!=7){
			throw new WrongFormatException("Expect 7 Filed Data,But only get "+datas.length+" fields");
		}
		this.fileName = fileName;
		this.rawInfo = rawInfo;
		this.sequenceId = datas[0];
		this.account = datas[1];
		this.amount = Integer.parseInt(datas[2]);
		this.chargeDate=  datas[3];
		this.chargeStatusCode = datas[4];
		this.serviceCode = datas[5];
		this.chargeSrc = datas[6];
		
	}
	
	
}
